<!doctype html>
<html lang="en" data-color-mode="dark">
<head>
<meta charset="utf-8">
<title>Homebrew 备忘清单
 &#x26;  homebrew cheatsheet &#x26;  Quick Reference</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta description="Homebrew 备忘清单
===

Homebrew 是 macOS(或Linux)缺少的包管理器，备忘清单包含 brew 命令的使用与安装，为开发人员分享快速参考备忘单。">
<meta keywords="homebrew,reference,Quick,Reference,cheatsheet,cheat,sheet">
<link rel="icon" href="data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20height%3D%221em%22%20width%3D%221em%22%3E%20%3Cpath%20d%3D%22m21.66%2010.44-.98%204.18c-.84%203.61-2.5%205.07-5.62%204.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2%201.17-2.42%203.16-3.07%206.5-2.28l1.67.39c4.19.98%205.47%203.05%204.49%207.23Z%22%20fill%3D%22%23c9d1d9%22%2F%3E%20%3Cpath%20d%3D%22M15.06%2019.39c-.62.42-1.4.77-2.35%201.08l-1.58.52c-3.97%201.28-6.06.21-7.35-3.76L2.5%2013.28c-1.28-3.97-.22-6.07%203.75-7.35l1.58-.52c.41-.13.8-.24%201.17-.31-.3.61-.54%201.35-.74%202.2l-.98%204.19c-.98%204.18.31%206.24%204.48%207.23l1.68.4c.58.14%201.12.23%201.62.27Zm2.43-8.88c-.06%200-.12-.01-.19-.02l-4.85-1.23a.75.75%200%200%201%20.37-1.45l4.85%201.23a.748.748%200%200%201-.18%201.47Z%22%20fill%3D%22%23228e6c%22%20%2F%3E%20%3Cpath%20d%3D%22M14.56%2013.89c-.06%200-.12-.01-.19-.02l-2.91-.74a.75.75%200%200%201%20.37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z%22%20fill%3D%22%23228e6c%22%20%2F%3E%20%3C%2Fsvg%3E" type="image/svg+xml">
<link rel="stylesheet" href="..\style\style.css">
<link rel="stylesheet" href="..\style\katex.css">
</head>
<body><nav class="header-nav"><div class="max-container"><a href="..\index.html" class="logo"><svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" height="1em" width="1em">
  <path d="m21.66 10.44-.98 4.18c-.84 3.61-2.5 5.07-5.62 4.77-.5-.04-1.04-.13-1.62-.27l-1.68-.4c-4.17-.99-5.46-3.05-4.48-7.23l.98-4.19c.2-.85.44-1.59.74-2.2 1.17-2.42 3.16-3.07 6.5-2.28l1.67.39c4.19.98 5.47 3.05 4.49 7.23Z" fill="#c9d1d9"></path>
  <path d="M15.06 19.39c-.62.42-1.4.77-2.35 1.08l-1.58.52c-3.97 1.28-6.06.21-7.35-3.76L2.5 13.28c-1.28-3.97-.22-6.07 3.75-7.35l1.58-.52c.41-.13.8-.24 1.17-.31-.3.61-.54 1.35-.74 2.2l-.98 4.19c-.98 4.18.31 6.24 4.48 7.23l1.68.4c.58.14 1.12.23 1.62.27Zm2.43-8.88c-.06 0-.12-.01-.19-.02l-4.85-1.23a.75.75 0 0 1 .37-1.45l4.85 1.23a.748.748 0 0 1-.18 1.47Z" fill="#228e6c"></path>
  <path d="M14.56 13.89c-.06 0-.12-.01-.19-.02l-2.91-.74a.75.75 0 0 1 .37-1.45l2.91.74c.4.1.64.51.54.91-.08.34-.38.56-.72.56Z" fill="#228e6c"></path>
</svg>
<span class="title">Quick Reference</span></a><div class="menu"><a href="javascript:void(0);" class="searchbtn" id="searchbtn"><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
  <path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"></path>
</svg><span>搜索</span><span>⌘K</span></a><a href="https://github.com/jaywcjlove/reference/blob/main/docs/homebrew.md" class="" target="__blank"><svg viewBox="0 0 36 36" fill="currentColor" height="1em" width="1em"><path d="m33 6.4-3.7-3.7a1.71 1.71 0 0 0-2.36 0L23.65 6H6a2 2 0 0 0-2 2v22a2 2 0 0 0 2 2h22a2 2 0 0 0 2-2V11.76l3-3a1.67 1.67 0 0 0 0-2.36ZM18.83 20.13l-4.19.93 1-4.15 9.55-9.57 3.23 3.23ZM29.5 9.43 26.27 6.2l1.85-1.85 3.23 3.23Z"></path><path fill="none" d="M0 0h36v36H0z"></path></svg><span>编辑</span></a><button id="darkMode" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="light" height="1em" width="1em">
  <path d="M6.995 12c0 2.761 2.246 5.007 5.007 5.007s5.007-2.246 5.007-5.007-2.246-5.007-5.007-5.007S6.995 9.239 6.995 12zM11 19h2v3h-2zm0-17h2v3h-2zm-9 9h3v2H2zm17 0h3v2h-3zM5.637 19.778l-1.414-1.414 2.121-2.121 1.414 1.414zM16.242 6.344l2.122-2.122 1.414 1.414-2.122 2.122zM6.344 7.759 4.223 5.637l1.415-1.414 2.12 2.122zm13.434 10.605-1.414 1.414-2.122-2.122 1.414-1.414z"></path>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24" class="dark" height="1em" width="1em">
  <path d="M12 11.807A9.002 9.002 0 0 1 10.049 2a9.942 9.942 0 0 0-5.12 2.735c-3.905 3.905-3.905 10.237 0 14.142 3.906 3.906 10.237 3.905 14.143 0a9.946 9.946 0 0 0 2.735-5.119A9.003 9.003 0 0 1 12 11.807z"></path>
</svg>
</button><script src="../js/dark.js?v=1.4.1"></script><a href="https://github.com/jaywcjlove/reference" class="" target="__blank"><svg viewBox="0 0 16 16" fill="currentColor" height="1em" width="1em"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg></a></div></div></nav><div class="wrap h1body-exist max-container"><header class="wrap-header h1wrap"><h1 id="homebrew-备忘清单"><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em">
  <path d="M7.938 0a.214.214 0 0 0-.206.156c-.316 1.104.179 2.15.838 2.935.153.181.313.347.476.501a2.039 2.039 0 0 0-.665.02c-1.184.233-2.193.985-2.74 2.532a3.893 3.893 0 0 0-.2 1.466 1.565 1.565 0 0 0-1.156 1.504 1.59 1.59 0 0 0 1.227 1.541l.026 12.046c0 .195.1.377.264.482a.214.214 0 0 0 .008.005c.537.31 2.047.812 5.21.812 3.238 0 4.7-.678 5.181-1.04a.214.214 0 0 0 .008-.007.571.571 0 0 0 .206-.439c.002-.344.002-1.136.002-1.604a.143.143 0 0 1 .147-.144c.397.006.869.006 1.318.005a1.826 1.826 0 0 0 1.832-1.825v-5.804a1.826 1.826 0 0 0-1.825-1.826H16.56a.14.14 0 0 1-.143-.144V10.6h.007v-.001a1.573 1.573 0 0 0 1.356-1.556c0-.816-.627-1.489-1.424-1.563-.025-1.438-.437-2.126-.736-2.58a.214.214 0 0 0-.005-.007c-.364-.51-1.193-1.282-2.275-1.316-.503-.016-.842.124-1.125.254-.217.1-.42.177-.67.22.002-1.286.945-1.981.945-1.981a.214.214 0 0 0 .05-.298s-.087-.122-.21-.26c-.121-.136-.269-.294-.47-.378a.214.214 0 0 0-.079-.017.214.214 0 0 0-.145.055 4.308 4.308 0 0 0-.875 1.101 3.42 3.42 0 0 0-.133.273 3.497 3.497 0 0 0-.381-.846C9.794.978 9.063.436 8.017.016A.214.214 0 0 0 7.939 0zm.156.524c.85.378 1.43.83 1.79 1.403.274.438.426.962.484 1.584a3.07 3.07 0 0 0-.012.462 6.897 6.897 0 0 1-.168-.052 5.487 5.487 0 0 1-1.29-1.106c-.551-.657-.935-1.46-.804-2.291zM11.8 1.618c.07.054.141.101.212.18.034.039.032.04.058.073-.332.308-1.07 1.144-.952 2.453a.214.214 0 0 0 .222.195c.469-.017.782-.172 1.056-.299.273-.126.508-.228.931-.214.875.027 1.639.715 1.939 1.134.295.449.65 1 .663 2.36a1.66 1.66 0 0 0-.41.142 1.938 1.938 0 0 0-1.77-1.16 1.94 1.94 0 0 0-1.87 1.448 1.783 1.783 0 0 0-1.356-.64c-.484 0-.91.205-1.233.517a1.873 1.873 0 0 0-1.85-1.625c-.649 0-1.218.335-1.552.84a3.1 3.1 0 0 1 .157-.735c.51-1.437 1.355-2.045 2.42-2.254.367-.073.664-.011.99.095.325.106.671.262 1.094.342a.214.214 0 0 0 .252-.245c-.112-.67.073-1.266.336-1.744a3.71 3.71 0 0 1 .663-.863zM7.44 6.611a1.442 1.442 0 0 1 1.363 1.925.214.214 0 0 0 .168.283h.005a.214.214 0 0 0 .238-.146 1.373 1.373 0 0 1 2.613-.01.214.214 0 0 0 .417-.09 1.509 1.509 0 0 1 1.504-1.664c.678 0 1.249.445 1.442 1.056a.214.214 0 0 0 .259.143l.15-.04a.214.214 0 0 0 .051-.02 1.139 1.139 0 0 1 1.702.995 1.14 1.14 0 0 1-.985 1.131.214.214 0 0 0-.001 0 2.215 2.215 0 0 0-.485.126 10.65 10.65 0 0 1-1.176.365.214.214 0 0 0-.162.186 1.276 1.276 0 0 1-.146.478 2.07 2.07 0 0 0-.239 1.111l.001.151a.438.438 0 0 1-.16.36.665.665 0 0 1-.43.14.586.586 0 0 1-.588-.59.803.803 0 0 0-.38-.681.214.214 0 0 0-.002-.002c-.24-.145-.43-.37-.532-.636a.214.214 0 0 0-.207-.138 19.469 19.469 0 0 1-5.37-.6l-.003-.002a9.007 9.007 0 0 0-.838-.194h.003a1.16 1.16 0 0 1-.937-1.134c0-.619.488-1.118 1.101-1.14a.214.214 0 0 0 .204-.176 1.443 1.443 0 0 1 1.42-1.187zm8.549 4.106v.455c0 .314.259.573.572.573h1.329a1.397 1.397 0 0 1 1.397 1.397v5.804a1.396 1.396 0 0 1-1.402 1.396.214.214 0 0 0-.002 0c-.448.002-.918 0-1.31-.005a.573.573 0 0 0-.584.573c0 .468 0 1.262-.002 1.603a.214.214 0 0 0 0 .001c0 .042-.019.08-.05.107-.346.26-1.75.95-4.915.95-3.107 0-4.587-.52-4.99-.752a.143.143 0 0 1-.065-.118l-.025-11.955c.145.033.288.07.431.11a.214.214 0 0 0 .003 0c.115.031.246.064.383.097v10.37c0 .129.069.247.18.31.453.217 1.767.732 4.071.732 2.32 0 3.595-.626 4.022-.884a.357.357 0 0 0 .164-.3l.001-10.21c.267-.075.531-.158.792-.254zm-7.99.894a.493.493 0 0 1 .494.493v8.578a.493.493 0 0 1-.493.493.493.493 0 0 1-.494-.493v-8.578A.493.493 0 0 1 8 11.611zm8.652 1.14a.663.663 0 0 0-.662.662v5.208a.663.663 0 0 0 .662.662h1.14a.663.663 0 0 0 .662-.662v-5.209a.663.663 0 0 0-.662-.662zm0 .428h1.14a.233.233 0 0 1 .233.233v5.21a.233.233 0 0 1-.233.232h-1.14a.233.233 0 0 1-.233-.233v-5.209a.233.233 0 0 1 .233-.233z"></path>
</svg>
<a aria-hidden="true" tabindex="-1" href="#homebrew-备忘清单"><span class="icon icon-link"></span></a>Homebrew 备忘清单</h1><div class="wrap-body">
<p>Homebrew 是 macOS(或Linux)缺少的包管理器，备忘清单包含 <a href="https://github.com/Homebrew/brew">brew</a> 命令的使用与安装</p>
</div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true">
  <path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path>
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#homebrew">Homebrew</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#安装">安装</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#命令">命令</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#更多包命令">更多包命令</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#brew-cask-命令">Brew Cask 命令</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#全局命令">全局命令</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#brew-清理">Brew 清理</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#brew-源码仓库">Brew 源码仓库</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#搜索查看">搜索查看</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#帮助命令">帮助命令</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#依赖">依赖</a><a aria-hidden="true" class="leve3 tocs-link" data-num="3" href="#卸载-homebrew">卸载 Homebrew</a><a aria-hidden="true" class="leve2 tocs-link" data-num="2" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="homebrew"><a aria-hidden="true" tabindex="-1" href="#homebrew"><span class="icon icon-link"></span></a>Homebrew</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist row-span-3"><div class="wrap-header h3wrap"><h3 id="安装"><a aria-hidden="true" tabindex="-1" href="#安装"><span class="icon icon-link"></span></a>安装</h3><div class="wrap-body">
<!--rehype:wrap-class=row-span-3-->
<pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line">/bin/bash <span class="token parameter variable">-c</span> <span class="token string">"<span class="token variable"><span class="token variable">$(</span><span class="token function">curl</span> <span class="token parameter variable">-fsSL</span> https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh<span class="token variable">)</span></span>"</span>
</span></code></pre>
<!--rehype:className=wrap-text -->
<p>加速安装和更新，将仓库源码通过 <a href="https://gitee.com/">gitee</a> 同步到国内，这样速度杠杠的</p>
<pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line"><span class="token comment"># 把 Homebrew/brew 的 Git 镜像放在这里</span>
</span><span class="code-line"><span class="token builtin class-name">export</span> <span class="token assign-left variable">HOMEBREW_BREW_GIT_REMOTE</span><span class="token operator">=</span><span class="token string">"..."</span>
</span><span class="code-line"><span class="token comment"># 将 Homebrew/homebrew-core 的 Git 镜像放在这里</span>
</span><span class="code-line"><span class="token builtin class-name">export</span> <span class="token assign-left variable">HOMEBREW_CORE_GIT_REMOTE</span><span class="token operator">=</span><span class="token string">"..."</span>
</span><span class="code-line">/bin/bash <span class="token parameter variable">-c</span> <span class="token string">"<span class="token variable"><span class="token variable">$(</span><span class="token function">curl</span> <span class="token parameter variable">-fsSL</span> https://raw.githubusercontent.com/Homebrew/install/master/install.sh<span class="token variable">)</span></span>"</span>
</span></code></pre>
<!--rehype:className=wrap-text -->
<p>在安装期间跳过克隆 (beta)</p>
<pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line"><span class="token builtin class-name">export</span> <span class="token assign-left variable">HOMEBREW_INSTALL_FROM_API</span><span class="token operator">=</span><span class="token number">1</span>
</span><span class="code-line">/bin/bash <span class="token parameter variable">-c</span> <span class="token string">"<span class="token variable"><span class="token variable">$(</span><span class="token function">curl</span> <span class="token parameter variable">-fsSL</span> https://raw.githubusercontent.com/Homebrew/install/master/install.sh<span class="token variable">)</span></span>"</span>
</span></code></pre>
<!--rehype:className=wrap-text -->
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="命令"><a aria-hidden="true" tabindex="-1" href="#命令"><span class="icon icon-link"></span></a>命令</h3><div class="wrap-body">
<p>命令 | 说明
:--- :---
<code>brew install git</code>         | <code>安装</code>一个软件包
<code>brew reinstall git</code>       | 重新<code>安装</code>一个软件包
<code>brew uninstall git</code>       | <code>删除</code>/<code>卸载</code>软件包
<code>brew upgrade git</code>         | 升级一个软件包
<code>brew upgrade</code>             | 升级所有可升级的包
:--- :---
<code>brew unlink git</code>          | 取消软件包的链接
<code>brew link git</code>            | 链接已有的软件包
<code>brew switch git 2.5.0</code>    | 切换软件包的版本
:--- :---
<code>brew list --versions git</code> | 查看安装的软件包及其版本信息</p>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="更多包命令"><a aria-hidden="true" tabindex="-1" href="#更多包命令"><span class="icon icon-link"></span></a>更多包命令</h3><div class="wrap-body">
<p>命令 | 说明
:--- :---
<code>brew info git</code>            | 显示软件包的版本、依赖、注意事项等信息
<code>brew cleanup git</code>         | 删除旧版本的软件包及其依赖
<code>brew edit git</code>            | 编辑此软件包的安装脚本
<code>brew cat git</code>             | 打印此软件包的安装脚本
<code>brew home git</code>            | 打开此软件包的主页
<code>brew search git</code>          | 搜索软件包公式并显示相关信息</p>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="brew-cask-命令"><a aria-hidden="true" tabindex="-1" href="#brew-cask-命令"><span class="icon icon-link"></span></a>Brew Cask 命令</h3><div class="wrap-body">
<p>命令 | 说明
:--- :---
<code>brew install --cask firefox</code> | 安装火狐浏览器
<code>brew list --cask</code>            | 列出已安装应用</p>
<p>Cask 命令用于与图形界面应用程序交互，可以安装和管理 macOS 上的图形界面应用程序</p>
</div></div></div><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="全局命令"><a aria-hidden="true" tabindex="-1" href="#全局命令"><span class="icon icon-link"></span></a>全局命令</h3><div class="wrap-body">
<!--rehype:wrap-class=row-span-2-->
<p>命令 | 说明
:--- :---
<code>brew update</code>   | 更新 <code>Homebrew</code> 和 <code>Cask</code>
<code>brew upgrade</code>  | 升级所有可升级的软件包
<code>brew list</code>     | 列出已安装的软件包
<code>brew outdated</code> | 列出需要升级的软件包
<code>brew doctor</code>   | 诊断 Homebrew 是否存在问题
<code>brew pin &#x3C;formula></code> | 防止指定软件包被升级
<code>brew unpin &#x3C;formula></code> | 允许指定软件包被升级</p>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="brew-清理"><a aria-hidden="true" tabindex="-1" href="#brew-清理"><span class="icon icon-link"></span></a>Brew 清理</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ brew cleanup <span class="token comment"># 删除旧版本的已安装软件包</span>
</span><span class="code-line">$ brew cleanup <span class="token operator">&#x3C;</span>formula<span class="token operator">></span> <span class="token comment"># 删除旧版本指定软件包</span>
</span><span class="code-line">$ brew cleanup <span class="token parameter variable">-s</span> <span class="token comment"># 删除未安装的软件包</span>
</span><span class="code-line">$ brew cleanup <span class="token parameter variable">--prune</span><span class="token operator">=</span>all <span class="token comment"># 删除所有 Homebrew 缓存</span>
</span><span class="code-line">$ <span class="token function">rm</span> <span class="token parameter variable">-rf</span> <span class="token variable"><span class="token variable">$(</span>brew <span class="token parameter variable">--cache</span><span class="token variable">)</span></span> <span class="token comment"># 直接删除 Homebrew 的缓存目录</span>
</span><span class="code-line"><span class="token comment"># 显示所有将被删除的软件包(试运行)</span>
</span><span class="code-line">$ brew cleanup <span class="token parameter variable">-n</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="brew-源码仓库"><a aria-hidden="true" tabindex="-1" href="#brew-源码仓库"><span class="icon icon-link"></span></a>Brew 源码仓库</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line"><span class="token comment"># 列出所有当前点击的源码仓库（点击）</span>
</span><span class="code-line">$ brew tap
</span><span class="code-line"><span class="token comment"># 使用 https 从 Github 中点击软件包源码仓库以点击</span>
</span><span class="code-line"><span class="token comment"># https://github.com/user/homebrew-repo</span>
</span><span class="code-line">$ brew tap <span class="token operator">&#x3C;</span>user/repo<span class="token operator">></span>
</span><span class="code-line"><span class="token comment"># 点击指定 URL 中的软件源码仓库</span>
</span><span class="code-line">$ brew tap <span class="token operator">&#x3C;</span>user/repo<span class="token operator">></span> <span class="token operator">&#x3C;</span>URL<span class="token operator">></span>
</span><span class="code-line"><span class="token comment"># 从存储库中删除给定的源码仓库</span>
</span><span class="code-line">$ brew untap <span class="token operator">&#x3C;</span>user/repo<span class="token operator">></span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="搜索查看"><a aria-hidden="true" tabindex="-1" href="#搜索查看"><span class="icon icon-link"></span></a>搜索查看</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line"><span class="token comment"># 列出所有已安装的软件包</span>
</span><span class="code-line">$ brew list
</span><span class="code-line"><span class="token comment"># 显示所有本地可用的 brew 配方</span>
</span><span class="code-line">$ brew search
</span><span class="code-line"><span class="token comment"># 搜索包含指定字符的 brew 配方</span>
</span><span class="code-line">$ brew search <span class="token operator">&#x3C;</span>text<span class="token operator">></span>
</span><span class="code-line"><span class="token comment"># 显示有关软件包的信息</span>
</span><span class="code-line">$ brew info <span class="token operator">&#x3C;</span>formula<span class="token operator">></span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="帮助命令"><a aria-hidden="true" tabindex="-1" href="#帮助命令"><span class="icon icon-link"></span></a>帮助命令</h3><div class="wrap-body">
<p>命令 | 说明
:--- :---
<code>brew help</code> | 打印帮助信息
<code>brew help &#x3C;sub-command></code> | 打印子命令的帮助信息</p>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="依赖"><a aria-hidden="true" tabindex="-1" href="#依赖"><span class="icon icon-link"></span></a>依赖</h3><div class="wrap-body">
<p>显示<code>包</code>的依赖关系。 特定于<code>包</code>的其他选项可能是附加到命令</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line"><span class="token comment"># 您还可以看到包和依赖关系图</span>
</span><span class="code-line">$ brew deps <span class="token parameter variable">--tree</span> <span class="token parameter variable">--installed</span>
</span><span class="code-line">$ brew deps <span class="token function">git</span> <span class="token comment"># 显示 git 依赖</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="卸载-homebrew"><a aria-hidden="true" tabindex="-1" href="#卸载-homebrew"><span class="icon icon-link"></span></a>卸载 Homebrew</h3><div class="wrap-body">
<ul>
<li>使用官方卸载脚本卸载 Homebrew</li>
<li>验证文件是否已删除</li>
</ul>
<pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line">$ /bin/bash <span class="token parameter variable">-c</span> <span class="token string">"<span class="token variable"><span class="token variable">$(</span><span class="token function">curl</span> <span class="token parameter variable">-fsSL</span> https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh<span class="token variable">)</span></span>"</span>
</span><span class="code-line">$ <span class="token function">sudo</span> <span class="token function">rm</span> <span class="token parameter variable">-rf</span> /opt/homebrew
</span></code></pre>
<!--rehype:className=wrap-text -->
</div></div></div></div></div><div class="wrap h2body-not-exist"><div class="wrap-header h2wrap"><h2 id="另见"><a aria-hidden="true" tabindex="-1" href="#另见"><span class="icon icon-link"></span></a>另见</h2><div class="wrap-body">
<ul>
<li><a href="https://brew.sh/index_zh-cn">Homebrew 官网</a> <em>(brew.sh)</em></li>
<li><a href="https://github.com/Homebrew/brew">Homebrew brew 源码</a> <em>(github.com)</em></li>
<li><a href="https://github.com/Homebrew/homebrew-core">Homebrew core 源码</a> <em>(github.com)</em></li>
</ul>
</div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 Kenny Wang.</footer></footer><script src="..\/data.js?v=1.4.1" defer></script><script src="..\/js/fuse.min.js?v=1.4.1" defer></script><script src="..\/js/main.js?v=1.4.1" defer></script><div id="mysearch"><div class="mysearch-box"><div class="mysearch-input"><div><svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 0 18 18">
  <path fill="currentColor" d="M17.71,16.29 L14.31,12.9 C15.4069846,11.5024547 16.0022094,9.77665502 16,8 C16,3.581722 12.418278,0 8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C9.77665502,16.0022094 11.5024547,15.4069846 12.9,14.31 L16.29,17.71 C16.4777666,17.8993127 16.7333625,18.0057983 17,18.0057983 C17.2666375,18.0057983 17.5222334,17.8993127 17.71,17.71 C17.8993127,17.5222334 18.0057983,17.2666375 18.0057983,17 C18.0057983,16.7333625 17.8993127,16.4777666 17.71,16.29 Z M2,8 C2,4.6862915 4.6862915,2 8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 Z"></path>
</svg><input id="mysearch-input" type="search" placeholder="搜索" autocomplete="off"><div class="mysearch-clear"></div></div><button id="mysearch-close" type="button">搜索</button></div><div class="mysearch-result"><div id="mysearch-menu"></div><div id="mysearch-content"></div></div></div></div></body>
</html>
